﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace HomeBuyerTools.Views.HomeRentOrBuy
{
    public partial class HomeRentOrBuy : PhoneApplicationPage
    {
        public HomeRentOrBuy()
        {
            InitializeComponent();
        }

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            double annualrent;
            double mortgageloanamt;
            if (txtMonthlyRent.Text != "")
                annualrent = Convert.ToDouble(txtMonthlyRent.Text) * 12;
            else
                annualrent = 0;
            double dpoh = Convert.ToDouble( txtDownPaymentOnHome.Text);
            double eppoh = Convert.ToDouble( txtEstimatedPurchasePriceOfHome.Text);
            if (dpoh > 0 && eppoh > 0)
                mortgageloanamt = (eppoh) - (dpoh);
            else
                mortgageloanamt=0;

            NavigationService.Navigate(new Uri("/Views/HomeRentOrBuy/Result.xaml?ari=" + txtAftertaxRateOfReturnOnInvestments.Text + "&mtr=" + txtMarginalTaxRate.Text + "eaa=" + txtEstimatedAnualAppreciationOfHome.Text + "&dp=" + txtDownPaymentOnHome.Text + "&ecc=" + txtEstimatedClosingCosts.Text + "&epp=" + txtEstimatedPurchasePriceOfHome.Text + "&mr=" + txtMonthlyRent.Text + "&raip=" + txtRentersAnnualInsurancePremium.Text + "&air=" + txtAnnualInterestRate.Text + "&tom=" + txtTermOfMortgage.Text + "&pt=" + txtPropertyTaxes.Text + "&hi=" + txtHomeownersInsurance.Text + "&m=" + txtMaintenance.Text + "&annualrent=" + annualrent + "&mortgageloanamt=" + mortgageloanamt, UriKind.Relative));

        }

       
    }
}